const db = require('./db')

module.exports = {
  get(username) {
    return db.query("SELECT * FROM `users` WHERE `username` = ?", [ username ])
  },
  get all() {
    return db.query("SELECT * FROM `users`")
  },
  add(params) {
    return db.query("INSERT INTO `users` (`username`,`password`,`salt`,`email`,`phone`) VALUES (?,?,?,?,?)", [
      params.username,
      params.password,
      params.salt,
      params.email,
      params.phone,
    ])
  }
}